const less = require('less');

function lessLoader(source) {
    console.log('lessLoader');
    const callback = this.async();
    setTimeout(() => {
        console.log('lessLoader timeout');
        less.render(source, {}, (err, res) => {
            source = res.css;
            source = source.replace(/\n/g, '');
        })
        callback(null, JSON.stringify(source));
    }, 2000);
    // less.render(source, {}, (err, res) => {
    //     source = res.css;
    //     source = source.replace(/\n/g, '');
    // })
    // return JSON.stringify(source);
}

module.exports = lessLoader;